package com.camunda7.workflow.services;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Service;


@Service("serviceDemo")
public class ServiceDemo {
    /**
     * 对应 camunda7 service任务的 expression实现方式。
     *
     * #{serviceDemo.service2(execution)}
     *   返回值变量为result
     *
     * #{serviceDemo.service3(execution)}
     */



    public String service2(DelegateExecution execution){
        System.out.println("service2 被调用");

        String foo = (String) execution.getVariable("foo");
        System.out.println("service1 传过来的变量：" + foo);
        return "result from service2";
    }

    public void service3(DelegateExecution execution){
        System.out.println("service3 被调用");

        String result = (String) execution.getVariable("result");
        System.out.println("service2的返回值，被存入bpmn定义的变量result： " + result);
    }

}
